<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@include file="/jsp/common/head.jsp" %>
<script>
    history.replaceState(null, null, "<c:url value="/supplier"/>");
</script>

<div class="card-header d-flex justify-content-between">
    <div class="header-title">
        <h4 class="card-title">
            供货商查询
        </h4>
    </div>
</div>
<div class="card-body">
    <p style="color: red">${msg}</p>
    <form class="form-horizontal" action="#">
        <div class="form-group row">
            <label for="param" class="control-label align-self-center col-1">查询：</label>
            <input id="param" name="param" class="form-control col-4">
            <select class="form-control col-2" name="method">
                <option value="queryAll" selected>查询全部</option>
                <option value="queryBySname">通过名称查询</option>
                <option value="queryBySupply">通过供货材料查询</option>
            </select>
        </div>
        <div class="row">
            <div class="col-2">
                <button class="btn btn-outline-primary">
                    <i class="las la-search"></i>查询
                </button>
            </div>
            <div class="col-2">
                <a class="btn btn-outline-primary" href="<c:url value="/jsp/supplier/edit.jsp"/>">
                    <i class="las la-plus-circle"></i>新增
                </a>
            </div>
        </div>
    </form>
    <div class="table-responsive">
        <table class="table table-hover" style="text-align:center;">
            <thead>
            <tr class="ligth">
                <th scope="col">编号</th>
                <th scope="col">供货商名称</th>
                <th scope="col">联系人</th>
                <th scope="col">供货产品</th>
                <th scope="col">电话1</th>
                <th scope="col">电话2</th>
                <th scope="col">信誉评价</th>
                <th scope="col">备注</th>
                <th scope="col">操作</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach var="supplier" items="${suppliers}">
                <tr>
                    <th scope="col">${supplier.sid}</th>
                    <th scope="col">${supplier.sname}</th>
                    <th scope="col">${supplier.contact}</th>
                    <th scope="col">${supplier.supply}</th>
                    <th scope="col">${supplier.phone1}</th>
                    <th scope="col">${supplier.phone2}</th>
                    <th scope="col">${supplier.reputation}</th>
                    <th scope="col">${supplier.remark}</th>
                    <th scope="col">
                        <a class="btn btn-outline-primary" type="button"
                           href="<c:url value="/supplier?method=toEdit&sid=${supplier.sid}"/>">
                            <i class="las la-pen"></i>
                        </a>
                        <a class="btn btn-outline-danger" type="button"
                           href="<c:url value="/supplier?method=delete&sid=${supplier.sid}"/>">
                            <i class="las la-trash"></i>
                        </a>
                    </th>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>
</div>

<%@include file="/jsp/common/footer.jsp" %>

